package com.lmh.controller;

import com.alibaba.fastjson2.JSONObject;
import com.lmh.common.Result;
import com.lmh.service.OfflineAnalyticService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @program bigdata-service
 * @Description 离线分析服务
 * @Author limeihua
 * @Date 2024/08/04 23:21
 * @Version 1.0
 */
@RestController
@Api(tags = "离线分析开发")
public class OfflineAnalyticController {
    @Autowired
    private OfflineAnalyticService offlineAnalyticService;
    /**
     * 通用离线分析接口
     * @param params
     * @return
     */
    @ApiOperation("通用离线分析接口")
    @PostMapping(value = "/OfflineAnalytic")
    public Result handle(@RequestBody String params){
        JSONObject paramsJson = JSONObject.parseObject(params);
        String executeResult = offlineAnalyticService.execute(paramsJson);
        Result result = Result.Ok();
        result.put("data", executeResult);
        return result;
    }
}
